package com.gelsanalyzer;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import java.math.*;
import java.util.*;

import com.gelsanalyzer.data.*;
/*
 * TestDataMarshalling is a simple test of concept to check the feasibility 
 * of using code generators to generate our object code for the DAL in our
 * project. 
 * Last modified by JO
 * on: 1/19/2008 
 */
public class TestDataMarshalling {

    public static void main(String[] args) {
        
        Courses courses = new Courses();
        List<Course> course = courses.getCourse();
        course.add(new Course());

        List<Gels> gels = courses.getCourse().get(0).getGels();
        gels.add(new Gels());
        gels.get(0).setNum(5);

        System.out.println("I'm cooking with gas now!!!!");
        
        course.get(0).setDepartment("MATH");
        course.get(0).setDescription("Calculus II with a 70% attrition Rate");
        course.get(0).setNumber(BigInteger.valueOf(321));
        try {
            JAXBContext context = JAXBContext
                .newInstance("com.gelsanalyzer.data");

            Marshaller marshaller = context.createMarshaller();
            marshaller.marshal(courses, System.out);
            
        } catch (JAXBException e ) {
            e.printStackTrace(System.out);
        }
    }
}
